package com.heiqin.Controller;


import com.heiqin.Pojo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;


import javax.annotation.Resource;
import java.util.List;

@Api(tags = "用户控制类")
@RestController
public class UserController {


    @Value("${server.port}")
    private String port;

    @GetMapping("/a1")
    @ApiOperation("serverport端口")
    public String geta(){
        return "servier" + port;
    }

    @GetMapping("/user")
    @ApiOperation("用户声明类")
    public User getUser(){
        User user = new User(1,"heiqin","swagger","test");
        return user;
    }

    @PostMapping("/user")
    @ApiOperation("添加用户")
    public User addUser( Integer id, String  username, String address, String jobs){
        User user = new User(id,username,address,jobs);
        return user;
    }
}
